import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import { ReqPage, ResPage } from "../interface";
/**
 * @name 分页查询角色
 */
export const loadRoleList = () => {
  return http.get<Role.ResRole[]>(PORT1 + `/system/sys-role/simple-list`);
};

export const getRoleList = (params: Role.ReqRole) => {
  return http.get<ResPage<Role.ResRole>>(PORT1 + `/system/sys-role/list`, params);
};
export const saveRole = (params: Role.ReqRole) => {
  return http.post<ResPage<Role.ResRole>>(PORT1 + `/system/sys-role/save`, params);
};
export const editRole = (params: Role.ReqRole) => {
  return http.post<ResPage<Role.ResRole>>(PORT1 + `/system/sys-role/update`, params);
};

export namespace Role {
  export interface ResRole {
    id: number;
    roleKey: string;
    roleName: string;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
  export interface ReqRole extends ReqPage {
    id: number;
    roleKey: string;
    roleName: string;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
}
